package com.tf_cut.backend.person.service.impl;


import com.tf_cut.backend.common.pojo.Result;
import com.tf_cut.backend.common.service.CommonServiceImpl;
import com.tf_cut.backend.person.pojo.PersonBank;
import com.tf_cut.backend.person.repository.PersonBankRepository;
import com.tf_cut.backend.person.service.PersonBankService;
import com.tf_cut.backend.person.vo.PersonBankVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Service
@Transactional
@Slf4j
public class PersonBankServiceImpl extends CommonServiceImpl<PersonBankVo, PersonBank, String> implements PersonBankService {

    @PersistenceContext
    private EntityManager em;
    @Autowired
    private PersonBankRepository personBankRepository;


    @Override
    public Result<PersonBankVo> insertBank(PersonBankVo avo) {
        log.info("insertBank reqParam:{}",avo);
        Result<PersonBankVo> result = null;
        try {
            result = this.save(avo);
        }catch (Exception e){
            log.error("insertBank error:{}",e.getMessage(),e);
        }
        return result;
    }
}
